import {http} from '@/utils/http/axios';

/**
 * 获取会话列表
 * @param params
 */
export function getConversationList(params?: any) {
  if (params) {
    params = {
      ...params,
      tag: import.meta.env.VITE_APP_DEFAULT_TAG,
    }
  }
  return http.request({
      url: '/conversation/list',
      method: 'POST',
      params,
    },
    {
      isTransformResponse: false,
    });
}

/**
 * 删除会话
 * @param params
 */
export function deleteConversation(id: string) {
  return http.request({
      url: `/conversation/${id}`,
      method: 'DELETE',
    },
    {
      isTransformResponse: false,
    });
}

/**
 * 删除问答
 * @param params
 */
export function deleteConversationChat(id: string) {
  return http.request({
      url: `/conversation/chat/${id}`,
      method: 'DELETE',
    },
    {
      isTransformResponse: false,
    });
}
export function deleteBatchConversation(params?: any) {
  return http.request({
      url: `/conversation/delete`,
      method: 'POST',
      params,
    },
    {
      isTransformResponse: false,
    });
}

/**
 * 更新会话
 * @param params
 */
export function updateConversation(params?: any) {
  return http.request({
      url: `/conversation/${params['id']}`,
      method: 'POST',
      params,
    },
    {
      isTransformResponse: false,
    });
}

export function getChatList(params?: any) {
  return http.request({
      url: '/chat/list',
      method: 'POST',
      params,
    },
    {
      isTransformResponse: false,
    });
}
